﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Data;
using System.Collections.ObjectModel;

namespace LuanVanProject
{
    /// <summary>
    /// Interaction logic for ErrorViewer.xaml
    /// </summary>
    public partial class ErrorViewer : UserControl
    {
        ObservableCollection<Error> list = new ObservableCollection<Error>();

        public ObservableCollection<Error> ListError
        {
            get { return list; }
            set { list = value; }
        }
       
        public class Error
        {
            private string index;

            public string Index
            {
                get { return index; }
                set { index = value; }
            }
            private string nodeName;

            public string NodeName
            {
                get { return nodeName; }
                set { nodeName = value; }
            }
            private string descript;

            public string Descript
            {
                get { return descript; }
                set { descript = value; }
            }
            private string suggestion;

            public string Suggestion
            {
                get { return suggestion; }
                set { suggestion = value; }
            }
        
        }

        public ErrorViewer()
        {
            InitializeComponent();
        }
        public void ViewError(List<NodeError> listError)
        {
            list.Clear() ;
            //errorDataGrid.Items.Clear();
            for(int i=0;i<listError.Count;i++)
            {
                NodeError ne = listError[i];
                Error err = new Error();
                err.Index = i.ToString();
                err.NodeName = ne.nodeName;
                err.Descript = ne.errorType.Description;
                err.Suggestion = ne.errorType.Suggestion;
                list.Add(err);                
            }
            
                    
        }
    }
}
